package com.diyphonegadgets.freeblog.ui.adapter;

import java.util.List;

import com.diyphonegadgets.freeblog.R;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;


public class GalleryAdapter extends BaseAdapter {
    int mGalleryItemBackground;
    List<Integer> imageList;
    
    public GalleryAdapter(Context c, List<Integer> imgList) {
        mContext = c;
        imageList=imgList;
    }

    public int getCount() {
        return imageList.size();
    }

    public Object getItem(int position) {
        return position;
    }

    public long getItemId(int position) {
        return position;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        ImageView i = new ImageView(mContext);

        i.setImageResource(imageList.get(position));
        i.setScaleType(ImageView.ScaleType.CENTER_CROP);
        i.setLayoutParams(new Gallery.LayoutParams(40, 40));
        
        // The preferred Gallery item background
        i.setBackgroundResource(mGalleryItemBackground);
        
        return i;
    }

    private Context mContext;

    private Integer[] mImageIds = {
            R.drawable.ioio,
            R.drawable.wifi,
            R.drawable.drone,
            R.drawable.raspberry_pi,
            R.drawable.infrared,
            R.drawable.android,
            R.drawable.arduino,
            R.drawable.bluetooth,
            R.drawable.usb,
    };
    



    
}
